﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using System.Collections;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

using AimGameEngine.EditorObject;

using AimGameLibrary;
using AimGameLibrary.GameObject;

namespace AimGameEngine.NodeEditorObject
{
    public class NodeIrrKlangPlayer : NodeBaseControl
    {
        public Boolean PlayLoop;

        public String GetFilE { get { return MyData.Data.Substring(MyData.Data.LastIndexOf("\\") + 1); } }

        public NodeIrrKlangPlayer(SpriteBatch inputspritebatch, Camera inputcamera, NodeData inputData
            , List<IDraw> MyListDraw, List<IUpdateMainTime> MyListUpdateTime, Dictionary<String, NodeObject> MyListObject, Dictionary<String, NodeObject> MyListType)
            : base(inputspritebatch, inputcamera, inputData, MyListDraw,MyListUpdateTime, MyListObject, MyListType)
        {
            
            PlayLoop = false;

            Connecter inputUpdate = new Connecter(inputspritebatch, inputcamera, Syco.Output, NodeTypeValue.Update, this);
            ListConnectpoint.Add(inputUpdate);
        }

        public override void ShowProprety(ArrayList Temp, CallBack input)
        {
            base.ShowProprety(Temp, input);
            PropretyIrrKlangPlayer IrrKlangPlayerproprety = new PropretyIrrKlangPlayer(this);
            //IrrKlangPlayerproprety.Deactivate += new EventHandler(input.Deactivate);
            IrrKlangPlayerproprety.okButton.Click += new EventHandler(input.Deactivate);
            IrrKlangPlayerproprety.ShowDialog();
            
        }

        public override void SaveData(ArrayList Thislist, SaveMode inputsavemode)
        {
            base.SaveData(Thislist, inputsavemode);

            if (MyData.Data != null)
                Thislist.Add(MyData.Data);
            else Thislist.Add("NULL");

            if (MyData.Data != null)
            Thislist.Add(GetFilE);
            else Thislist.Add("NULL");

            Thislist.Add(PlayLoop);
        }

        public override void LoadData(Identification getdata, int IndexData)
        {
            base.LoadData(getdata, IndexData);

            if (getdata.Items.GetValue(IndexData + 1).GetType() == typeof(String))
                MyData.Data = (String)getdata.Items.GetValue(IndexData + 1);

            if (getdata.Items.GetValue(IndexData + 3).GetType() == typeof(Boolean))
                PlayLoop = (Boolean)getdata.Items.GetValue(IndexData + 3);
        }
    }
}
